﻿@{
    ViewBag.Title = "Ins";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js?ver=GetDate()")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ToolbarBillList.cshtml")
    
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">单据日期：</td>
                <td width ="310px">
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">审核状态：</td>
                <td width ="87px">
                    <input id="comCheckFlag" name ="FCheckFlag" class="mini-combobox" style="width:87px;" 
                    showNullItem="false" required="true" allowInput="false" align="left" data ="dCheckFlag"/>  
                </td>
                <td width ="70px" align="right">商品搜索：</td>
                <td width ="150px">
                    <input name="FNumber" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
        </table>        
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetBillDetail"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="false"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div type="checkcolumn" ></div>  
                <div field="FDate" width="90px" dateFormat="yyyy-MM-dd" headerAlign="center">单据日期</div> 
                <div field="FGoodsCode" width="120" headerAlign="center">主商品条码</div>
                <div field="FGoodsName" width="160" headerAlign="center">主商品名称</div>
                <div field="FNumber" width="90" headerAlign="center">商品编码</div>
                <div field="FCode" width="120" headerAlign="center">商品条码</div>
                <div field="FName" width="150" headerAlign="center">商品名称</div>
                <div field="FSpec" width="80" headerAlign="center">规格型号</div>
                <div field="FUnitName" width="40" headerAlign="center">单位</div>
                <div field="mFQty" name="mFQty" width="70" headerAlign="center"align="right"numberFormat="#,0.00">数量</div>                
                <div field="FPosPrice" name="FPosPrice" width="70" headerAlign="center"align="right"numberFormat="#,0.00">零售价</div>
                <div field="FPosAmount" name="FPosAmount" width="90" headerAlign="center"align="right"numberFormat="#,0.00">零售金额</div>                
                <div field="FRemark" width="120" headerAlign="center">明细备注</div>
                <div field="FRemark" width="120" headerAlign="center">备注</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">

        var dCheckFlag = [{ "id": "0", "text": "全部" },
                         { "id": "1", "text": "未审核" },
                         { "id": "2", "text": "已审核" }]

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDate1").setValue(nowDate);
            mini.getbyName("FDate2").setValue(nowDate);
            mini.getbyName("FCheckFlag").select(0);
            LoadData();
            InitGrid('BllDetailIns');
        }

        function clearloca() {
            mini.getbyName("FNumber").setValue("");
        }

        function editBill() {
            if (!mini.get("edit").getVisible()) return;
            var row = grid.getSelected();
            if (row) {
                parent.window.showTabByIdEx('106','GoodPackPromotion', '商品组合单', '../Coupon/GoodPackPromotion?datatype=23&billid=' + row.FGoodsID);
            }
        }

        function LoadData() {
            var cDate1 = mini.getbyName("FDate1").getFormValue();
            var cDate2 = mini.getbyName("FDate2").getFormValue();
            var mCheckFlag = mini.getbyName("FCheckFlag").getValue();
            var mNumber = mini.getbyName("FNumber").getValue();

            var json = "[{";
            json = json + '"mListType":' + '"23",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDate1":' + '"' + cDate1 + '",';
            json = json + '"mDate2":' + '"' + cDate2 + '",';
            json = json + '"mCheckFlag":' + '"' + mCheckFlag + '",';
            json = json + '"mNumber":' + '"' + mNumber + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function onLoad(e) {
            var grid = e.sender;
            var marges = [
                { rowIndex: 1, columnIndex: 0, rowSpan: 1, colSpan: 2 },
                { rowIndex: 3, columnIndex: 0, rowSpan: 4, colSpan: 3 }
            ];
            grid.mergeCells(marges);
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [0];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "采购明细表");
                }
            });
        }

    </script>

    </form>
</body>